<template>
	<view>
		<u-overlay :show="show" @click="click()">

			<view class="u-flex u-row-center" style="height: 100%;">
				<view style="background-color: #FFFFFF;border-radius: 24rpx;width: 60%;" @click.stop="()=>{}">
					<view class="u-flex u-row-center">
						<image v-if="data.type=='error'" src="../static/icon/error.png" style="width: 100%;"
							mode="widthFix" />
						<image v-else-if="data.type=='success'" src="../static/icon/success.png" style="width: 100%;"
							mode="widthFix" />
					</view>
					<view style="padding: 20rpx 40rpx;">
						<view style="text-align: center;color: #333333;font-size: 28rpx;">
							{{data.msg}}
						</view>
						<view style="text-align: center;color: #AAAAAA;font-size: 24rpx;margin-top: 10rpx;">
							{{data.subMsg}}
						</view>
						<view class="u-flex u-row-center" style="margin-top: 50rpx;">
							<view class="btn" :class="{'success':data.type=='success','error':data.type=='error'}"
								@click="click()">
								我知道了</view>
						</view>
					</view>
				</view>
			</view>
		</u-overlay>
	</view>
</template>

<script>
	export default {
		name: "toast",
		props: {
			show: {
				type: Boolean,
				default: false
			},
			data: {
				type: Object,
				default: () => {

				}
			}
		},
		data() {
			return {

			};
		},
		methods: {
			click() {
				this.$emit("change")
			}
		}
	}
</script>

<style lang="scss" scoped>
	.btn {
		width: 60%;
		line-height: 72rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		text-align: center;
		font-size: 26rpx;
		color: #FFFFFF;
	}

	.success {
		background: #007DF7;
	}

	.error {
		background: #FF4866;
	}
</style>